package config

import (
	"Software/global"
	"fmt"
	"github.com/spf13/viper"
)

func ConfigInit() {
	config := viper.New()
	config.AddConfigPath("./config/")
	config.SetConfigName("config")
	config.SetConfigType("json")
	err := config.ReadInConfig()
	if err != nil {
		_, ok := err.(viper.ConfigFileNotFoundError)
		if ok {
			fmt.Println("找不到配置文件")
		} else {
			fmt.Println("配置文件有问题", err)
		}
	}
	global.Config = config
}
